Arduino for Kids by Priya Kuber & Rishi Gaurav Bhatnagar & Vijay Varada

Arduino for Kids by Priya Kuber & Rishi Gaurav Bhatnagar & Vijay Varada

Author:Priya Kuber & Rishi Gaurav Bhatnagar & Vijay Varada [Kuber, Priya]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2017-03-23T04:00:00+00:00


Note

Using the internet, find out how to write constant and variable declarations in your code.

Do you remember how to run basic examples in your code? I am sure you do. But just in case you don't, go back to chapter 1 or 2 (find out which one) and find out how we run examples!

Remember we just learned about registers? All we need to do to access another register in LED blink example is to declare another pin, say pin 3, declare it, and add it in the following code:

Code:

// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 and pin 3 as an output. pinMode(13, OUTPUT); pinMode(3,OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(3,HIGH); delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW digitalWrite(3,LOW); delay(1000); // wait for a second }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.